﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity.Migrations;
using CollegeReview.Data;
using CollegeReview.DataModels;

namespace CollegeReview.Data
{
    public class Seeder
    {
        public static void Seed(ApplicationDbContext db, bool seedColleges=true, bool seedReviews=true)
        {
            if(seedColleges)
            {
                db.Colleges.AddOrUpdate(
                    c => c.University,
                    new College { University = "Stanford University", Location = "Palo Alto, CA", Summary = "Stanford University is not only one of the most prestigious universities in the U.S., but also the world. It has one the best computer science and engineering programs. Located in beautiful Palo Alto, CA, the scenery, beauty, and culture of the campus is breathtaking.", Image = "http://stanford.edu/about/images/intro_about.jpg", AvgRating = 10 },
                    new College { University = "University of California, Irvine", Location = "Irvine, CA", Summary = "UCI is the fastest growing university in the U.S., for 50 years or younger. For a university that is relatively new, it is quickly increasing its rank to becoming one of the world's best universities. They have a great computer science program that focuses on real life application over theory. UCI also has a great medical school. Being located in sunny Irvine, CA, you also have perfect weather and a 5 min drive to the beach and malls. ", Image = "http://www.paintingtucson.com/wp-content/uploads/2009/11/UCICloudyDay.jpg", AvgRating = 9 },
                    new College { University = "University of Texas", Location = "Austin, TX", Summary = "UT is the one of the best universities in the U.S., and the best in Texas. Located in the heart of downtown, across from the state capitol building in Austin, TX, one of the fastest growing cities driving the future of the U.S. in the tech field, it is the place to be if you're interested in tech. Austin is also the live music capitol of the U.S. and has a very lively food truck culture. UT is the school to be if you love football and want to bleed that longhorn orange.", Image = "http://philosophy.commons.gc.cuny.edu/files/2012/12/austin.jpg", AvgRating = 9 },
                    new College { University = "San Jose State University", Location = "San Jose, CA", Summary = "SJSU is the oldest univesity in the Califonia State Schools, making it the first. It is located in San Jose, CA, near Silicon Valley, the tech capital of the U.S. This gives SJSU the advantage of being a great school to study at for Computer Science students.", Image = "http://blogs.sjsu.edu/today/files/2012/05/instagr.am_.jpg", AvgRating = 8 }
                    );
                db.SaveChanges(); 
            }
            if (seedReviews)
            {
                db.Reviews.AddOrUpdate(
                    r=>r.Comment,
                    new Review { Comment = "Visited Stanford today. Fell in love with such a beautiful campus.", Rating = Rating.ten, Timestamp = DateTime.Now.ToFileTime().ToString(), CollegeId = 1 },
                    new Review { Comment = "Just finished my first year at UCI. So happy I decided to come here. The computer science program is amazing.", Rating = Rating.ten, Timestamp = DateTime.Now.ToFileTime().ToString(), CollegeId = 2 },
                    new Review { Comment = "After going to a UT game, and seeing everyone wearning the burnt orange color, I knew I had to go to UT. Graduting next month, I can honestly say these were the best 4 years of my life.", Rating = Rating.nine, Timestamp = DateTime.Now.ToFileTime().ToString(), CollegeId = 3},
                    new Review { Comment = "Since SJSU is located right next to Silicon Valley, it is a great place to be if you love technology and are an engineering or cs major! ", Rating = Rating.eight, Timestamp = DateTime.Now.ToFileTime().ToString(), CollegeId = 4 },
                    new Review { Comment = "I got into a few different colleges and didn't know which one to attend. I am so happy I chose UCI. I made some great friends and connections!", Rating = Rating.nine, Timestamp = DateTime.Now.ToFileTime().ToString(), CollegeId = 2 },
                    new Review { Comment = "It is such a privilege to be attending one the most prestigious universities in the world. Would not want to go anywhere else.", Rating = Rating.ten, Timestamp = DateTime.Now.ToFileTime().ToString(), CollegeId = 1 }
                    );
            }
        }
    }
}
